package base

import "git.mycaigou.com/gfyx/micro-gfyx-api/infrastructure/utils/auth"

type UsingPasswordRequest struct {
	TenantCode    string `json:"tenant_code" binding:"required"`
	Account       string `json:"account" binding:"required"`
	Password      string `json:"password" binding:"required"`
	CaptchaID     string `json:"captcha_id,omitempty"`
	CaptchaAnswer string `json:"captcha_answer,omitempty"`
	Remember      int32  `json:"remember"`
}

type UsingPasswordResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpireTime   int64  `json:"expire_time"`
}

type UsingPhoneRequest struct {
	TenantCode    string `json:"tenant_code" binding:"required"`
	Mobile        string `json:"mobile" binding:"required"`
	Code          string `json:"code" binding:"required"`
	CaptchaID     string `json:"captcha_id,omitempty"`
	CaptchaAnswer string `json:"captcha_answer,omitempty"`
	Remember      int32  `json:"remember"`
}

type UsingPhoneResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpireTime   int64  `json:"expire_time"`
}

type GetResetPasswordTokenRequest struct {
	TenantCode string `json:"tenant_code" binding:"required"`
	Mobile     string `json:"mobile,omitempty" binding:"required"`
	Code       string `json:"code,omitempty" binding:"required"`
}

type GetResetPasswordTokenResponse struct {
	Token string `json:"token"`
}

type ResetByPhoneRequest struct {
	TenantCode string `json:"tenant_code" binding:"required"`
	Mobile     string `json:"mobile,omitempty" binding:"required"`
	Password   string `json:"password,omitempty" binding:"required"`
	Code       string `json:"code,omitempty"`
	Token      string `json:"token,omitempty" binding:"required"`
}

type ResetByPhoneResponse struct {
}

type SsoRequest struct {
	AccessToken string `form:"access_token" binding:"required"`
	PageUri     string `form:"page_uri" binding:"required"`
	Redirect    int    `form:"redirect"`
}

type SsoResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpireTime   int64  `json:"expire_time"`
	Url          string `json:"url"`
}

type LoginUserInfo struct {
	User   *auth.LoginUserInfo `json:"user"`
	Tenant TenantInfo          `json:"tenant"`
}

type TenantInfo struct {
	TenantName string   `json:"tenant_name"`
	TenantCode string   `json:"tenant_code"`
	Profits    []string `json:"profits"`
}

type RefreshTokenRequest struct {
	TenantCode   string `json:"tenant_code" binding:"required"`
	RefreshToken string `json:"refresh_token" binding:"required"`
}

type RefreshTokenResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpireTime   int64  `json:"expire_time"`
}

type ReleaseAccountRequest struct {
	Sign       string `form:"sign" binding:"required"`
	Account    string `form:"account" binding:"required"`
	TenantCode string `form:"tenant_code" binding:"required"`
}
